package com.example.luyennghe;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;


public class translator extends Activity {
    private Button btnTranslate;
    private EditText edtTextToTrans;
    private TextView tvTextTranslated;
    String result = "";
    String textToTranslate = "";
    public void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.translator_layout);
        btnTranslate = (Button)findViewById(R.id.btnTrans);
        edtTextToTrans = (EditText)findViewById(R.id.edtTextToTrans);
        tvTextTranslated = (TextView)findViewById(R.id.tvTextTranslated); 
        btnTranslate.setOnClickListener(new OnClickListener() {
            
            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                textToTranslate = edtTextToTrans.getText().toString();
                TranslatorClass trans = new TranslatorClass();
                result = trans.translate(textToTranslate);
                tvTextTranslated.setText(result);
            }
        });
    }    
}